<!DOCTYPE html>
<!--suppress XmlHighlighting -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <!--suppress SpellCheckingInspection -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
          integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <!--suppress SpellCheckingInspection -->
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"
            integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

    <title>Grants - Census Entry Form</title>
</head>
<body>
<!--/*@thymesVar id="censusEntryCommand" type="scot.carricksoftware.grants.commands.census.CensusEntryCommand"*/-->
<!--/*@thymesVar id="person" type="scot.carricksoftware.grants.domains.people.Person"*/-->
<!--/*@thymesVar id="census" type="scot.carricksoftware.grants.domains.census.Census"*/-->

<div th:insert="~{fragments/layout::banner}"></div>

<div class="container border border-info
rounded-3 text-center p-4">
    <h3>Census Entry Details</h3>
    <form th:object="${censusEntryCommand}" th:action="@{/censusEntry}" method="post">
        <div th:if="${#fields.hasErrors('*')}" class="alert alert-danger">
            <p>Please Correct The Errors Below</p>
        </div>
        <table style="width:100%;">
            <tr>
                <td style="text-align: right;">
                    <label for="id"><span style="color: rgb(255,0,0);">*</span>Database Id :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="id"
                           th:field="*{id}" type="text" readonly>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="census">Census :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="census" style="width: 500px;" name="census" th:field="*{census}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="census : ${censuses}"
                                th:value="${census.id}" th:text="${census.toString()}"></option>
                    </select>
                    <div th:if="${#fields.hasErrors('census')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('census')}" th:text="${err}"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="sex">Male or Female :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="sex" style="width: 200px;" name="sex" th:field="*{sex}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.general.Sex).values()}"
                                th:value="${value}" th:text="${value.label}"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;background-color: #D6EEEE;">
                    <label for="person">Person :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="person" style="width: 200px;" name="person" th:field="*{person}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="person : ${people}"
                                th:value="${person.id}" th:text="${person.toString()}"></option>
                    </select>
                    <div th:if="${#fields.hasErrors('person')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('person')}" th:text="${err}"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;background-color: #D6EEEE;">
                    <label for="name">Untracked Person :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="name"
                           th:field="*{name}" type="text" style="width: 200px;">
                    <div th:if="${#fields.hasErrors('name')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('name')}" th:text="${err}" style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="relationship">Relationship to Head :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="relationship" style="width: 200px;" name="relationship" th:field="*{relationship}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.censusentry.CensusEntryRelationship).values()}"
                                th:value="${value}" th:text="${value.label}"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="condition">Condition :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="condition" style="width: 200px;" name="condition" th:field="*{condition}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.censusentry.CensusEntryCondition).values()}"
                                th:value="${value}" th:text="${value.label}"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="gaelic">Gaelic :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="gaelic" style="width: 200px;" name="gaelic" th:field="*{gaelic}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.censusentry.CensusEntryGaelic).values()}"
                                th:value="${value}" th:text="${value.label}"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="worker">Worker :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="worker" style="width: 200px;" name="worker" th:field="*{worker}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.censusentry.CensusEntryWorker).values()}"
                                th:value="${value}" th:text="${value.label}"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="age">Age :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="age"
                           th:field="*{age}" type="text">
                    <div th:if="${#fields.hasErrors('age')}">
                        <ul class="text-danger">&nbsp;
                            <li th:each="err : ${#fields.errors('age')}" th:text="${err}" style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="whereBorn">Where Born :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="whereBorn"
                           th:field="*{whereBorn}" type="text">
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="birthDay">Birthday (dd/mm): &nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="birthDay"
                           th:field="*{birthDay}" type="text">
                    <div th:if="${#fields.hasErrors('birthDay')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('birthDay')}" th:text="${err}"
                                style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="birthYear">Birth Year :&nbsp;</label>
                </td>
                <td>
                    <input class="form-control" id="birthYear"
                           th:field="*{birthYear}" type="text">
                    <div th:if="${#fields.hasErrors('birthYear')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('birthYear')}" th:text="${err}"
                                style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="yearsCompletedMarriage">Completed Years of Marriage : &nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="yearsCompletedMarriage"
                           th:field="*{yearsCompletedMarriage}" type="text">
                    <div th:if="${#fields.hasErrors('yearsCompletedMarriage')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('yearsCompletedMarriage')}" th:text="${err}"
                                style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="childrenBornAlive">Children Born Alive :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="childrenBornAlive"
                           th:field="*{childrenBornAlive}" type="text">
                    <div th:if="${#fields.hasErrors('childrenBornAlive')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('childrenBornAlive')}" th:text="${err}"
                                style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="childrenStillAlive">Children Still Alive :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="childrenStillAlive"
                           th:field="*{childrenStillAlive}" type="text">
                    <div th:if="${#fields.hasErrors('childrenStillAlive')}">
                        <ul class="text-danger">> Unsubscribe
                            <li th:each="err : ${#fields.errors('childrenStillAlive')}" th:text="${err}"
                                style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="childrenWhoHaveDied">Children Who Have Died :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="childrenWhoHaveDied"
                           th:field="*{childrenWhoHaveDied}" type="text">
                    <div th:if="${#fields.hasErrors('childrenWhoHaveDied')}">
                        <ul class="text-danger">
                            <li th:each="err : ${#fields.errors('childrenWhoHaveDied')}" th:text="${err}"
                                style="width: 300px;"/>
                        </ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="industryOrService">Industry or Service :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="industryOrService"
                           th:field="*{industryOrService}" type="text">
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="workingAtHome">Working at Home :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <select id="workingAtHome" style="width: 200px;" name="workingAtHome"
                            th:field="*{workingAtHome}">
                        <option th:value="${''}" th:text="${''}"></option>
                        <option th:each="value : ${T(scot.carricksoftware.grants.enums.general.YesNo).values()}"
                                th:value="${value}" th:text="${value.label}"></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="personalOccupation">Personal Occupation :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="personalOccupation" style="width: 400px;margin-right:20px;"
                           th:field="*{personalOccupation}" type="text">
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">
                    <label for="notes">Notes :&nbsp;</label>
                </td>
                <td style="text-align: left;">
                    <input class="form-control" id="notes" style="width: 400px;"
                           th:field="*{notes}" type="text">
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
            </tr>
        </table>

        <button type="submit" class="btn btn-primary">Commit</button>
        <a class="btn btn-secondary" th:href="@{/censusEntries}" th:text="${'List all'}">List all</a>
        <a class="btn btn-warning" th:href="@{/censusEntry/new}" th:text="${'New Entry'}">New Entry</a>
        <a class="btn btn-success" th:href="@{/}" th:text="${'Home'}">Home</a>
        <h6><span style="color: rgb(255,0,0);">*</span><span> Cannot be edited</span></h6>
    </form>
</div>
</body>
</html>