form.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!DOCTYPE html>
  2. <!--suppress XmlHighlighting -->
  3. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  4. <head>
  5. <!-- Required meta tags -->
  6. <meta charset="utf-8">
  7. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  8. <!-- Bootstrap CSS -->
  9. <!--suppress SpellCheckingInspection -->
  10. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
  11. integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  12. <!--suppress SpellCheckingInspection -->
  13. <script src="https://code.jquery.com/jquery-3.6.0.min.js"
  14. integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  15. <link rel="stylesheet" href="https://code.jquery.com/ui/1.14.1/themes/base/jquery-ui.css">
  16. <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
  17. <script src="https://code.jquery.com/ui/1.14.1/jquery-ui.js"></script>
  18. <!--suppress JSUnresolvedReference -->
  19. <script>
  20. $(function () {
  21. $("#datepicker").datepicker({dateFormat: "dd-mm-yy"}).val();
  22. });
  23. </script>
  24. <title>Grants - census form</title>
  25. </head>
  26. <body>
  27. <!--/*@thymesVar id="censusCommand" type="scot.carricksoftware.grants.commands.census.CensusCommand"*/-->
  28. <!--/*@thymesVar id="place" type="scot.carricksoftware.grants.domains.places.Place"*/-->
  29. <div th:insert="~{fragments/layout::banner}"></div>
  30. <div class="container border border-info
  31. rounded-3 text-center p-4">
  32. <form th:object="${censusCommand}" th:action="@{/census}" method="post">
  33. <div th:if="${#fields.hasErrors('*')}" class="alert alert-danger">
  34. <p>Please Correct The Errors Below</p>
  35. </div>
  36. <div class="form-group row justify-content-center">
  37. <div class="col-md-3">
  38. <label for="id">Database Id<span style="color: rgb(255,0,0);">*</span></label>
  39. <input class="form-control" id="id"
  40. th:field="*{id}" type="text" readonly>
  41. </div>
  42. <div class="col-md-3">
  43. <label for="censusDate">Date</label>
  44. <div>
  45. <select id="censusDate" style="width: 200px;" name="censusDate" th:field="*{censusDate}">
  46. <option th:value="${''}" th:text="${''}"></option>
  47. <option th:each="value : ${T(scot.carricksoftware.grants.enums.census.CensusDate).values()}"
  48. th:value="${value}" th:text="${value.label}"></option>
  49. </select>
  50. <div th:if="${#fields.hasErrors('censusDate')}">
  51. <ul class="text-danger">
  52. <li th:each="err : ${#fields.errors('censusDate')}" th:text="${err}"/>
  53. </ul>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="col-md-3">
  58. <label for="place">Place</label>
  59. <div>
  60. <select id="place" style="width: 200px;" name="place" th:field="*{place}">
  61. <option th:value="${''}" th:text="${''}"></option>
  62. <option th:each="place : ${places}"
  63. th:value="${place.id}" th:text="${place.toString()}"></option>
  64. </select>
  65. <div th:if="${#fields.hasErrors('place')}">
  66. <ul class="text-danger">
  67. <li th:each="err : ${#fields.errors('place')}" th:text="${err}"/>
  68. </ul>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="col-md-3">
  73. <label for="boundaryType">Boundary Type</label>
  74. <div>
  75. <select id="boundaryType" style="width: 200px;" name="boundaryType" th:field="*{boundaryType}">
  76. <option th:value="${''}" th:text="${''}"></option>
  77. <option th:each="value : ${T(scot.carricksoftware.grants.enums.census.CensusBoundaryType).values()}"
  78. th:value="${value}" th:text="${value.label}"></option>
  79. </select>
  80. <div th:if="${#fields.hasErrors('boundaryType')}">
  81. <ul class="text-danger">
  82. <li th:each="err : ${#fields.errors('boundaryType')}" th:text="${err}"/>
  83. </ul>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <div class="form-group row justify-content-center">
  89. <div class="col-md-3">
  90. <label for="inhabitedRooms">Inhabited Rooms</label>
  91. <input class="form-control" id="inhabitedRooms"
  92. th:field="*{inhabitedRooms}" type="text">
  93. <div th:if="${#fields.hasErrors('inhabitedRooms')}">
  94. <ul class="text-danger">
  95. <li th:each="err : ${#fields.errors('inhabitedRooms')}" th:text="${err}"/>
  96. </ul>
  97. </div>
  98. </div>
  99. <div class="col-md-3">
  100. <label for="roomsWithWindows">Rooms With Windows</label>
  101. <input class="form-control" id="roomsWithWindows"
  102. th:field="*{roomsWithWindows}" type="text">
  103. <div th:if="${#fields.hasErrors('roomsWithWindows')}">
  104. <ul class="text-danger">
  105. <li th:each="err : ${#fields.errors('roomsWithWindows')}" th:text="${err}"/>
  106. </ul>
  107. </div>
  108. </div>
  109. </div>
  110. <button type="submit" class="btn btn-primary">Commit</button>
  111. <a class="btn btn-secondary" th:href="@{/censuses}" th:text="${'List all'}">List all</a>
  112. <a class="btn btn-success" th:href="@{/}" th:text="${'Home'}">Home</a>
  113. <h6><span style="color: rgb(255,0,0);">*</span><span> Cannot be edited</span></h6>
  114. </form>
  115. </div>
  116. </body>
  117. </html>