formulario.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head th:replace="~{fragments/head :: head}">
  4. <meta charset="UTF-8">
  5. <title>Too Easy</title>
  6. </head>
  7. <body>
  8. <div th:replace="~{layout}">
  9. <div th:fragment="content">
  10. <section>
  11. <div class="container p-4 shadow bg-white rounded">
  12. <h1 class="mb-4" th:text="${titulo}"></h1>
  13. <form>
  14. <div class="mb-3">
  15. <input hidden="true" name="id" th:value="${compra.id}" type="text">
  16. <label class="form-label" for="fornecedor">Fornecedor</label>
  17. <input class="form-control" id="fornecedor" name="fornecedor" th:value="${compra.fornecedor}"
  18. type="text">
  19. </div>
  20. <br/>
  21. <div class="mb-3">
  22. <table class="table">
  23. <thead>
  24. <tr>
  25. <th>Código</th>
  26. <th>Item</th>
  27. <th>Valor</th>
  28. <th></th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. <tr th:each="item, stat : ${compra.itens}">
  33. <td>
  34. <input th:value="${item.id}" th:name="|itens[${stat.index}].id|" type="text" hidden="true">
  35. <input th:value="${item.id}" class="form-control" type="text" disabled>
  36. </td>
  37. <td>
  38. <input th:value="${item.descricao}" class="form-control"
  39. th:name="|itens[${stat.index}].descricao|" type="text" required>
  40. </td>
  41. <td><input th:value="${item.valor}" class="form-control" th:name="|itens[${stat.index}].valor|"
  42. type="text" required></td>
  43. <td>
  44. <button class="btn btn-outline-dark" formmethod="post"
  45. th:formaction="@{'/compra/' + ${stat.index}}"
  46. type="submit">
  47. <i class="bi bi-dash-square"></i>
  48. </button>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td><input class="form-control" type="text" disabled></td>
  53. <td><input class="form-control" th:name="descricao" type="text"></td>
  54. <td><input class="form-control" th:name="valor" type="text"></td>
  55. <td>
  56. <button class="btn btn-outline-dark" formmethod="post" th:formaction="@{/compra}"
  57. type="submit">
  58. <i class="bi bi-plus-square"></i>
  59. </button>
  60. </tr>
  61. </tbody>
  62. </table>
  63. </div>
  64. <button class="btn btn-dark" formmethod="post" th:formaction="@{/compra/salvar}" type="submit">Salvar
  65. </button>
  66. </form>
  67. </div>
  68. </section>
  69. </div>
  70. </div>
  71. </body>
  72. </html>