aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources
diff options
context:
space:
mode:
authormrfoxygmfr <mrfoxygmfr@sch9.ru>2025-04-28 00:45:56 +0300
committermrfoxygmfr <mrfoxygmfr@sch9.ru>2025-04-28 00:45:56 +0300
commite9cef81f89584110776c84ee511e26097eb8323c (patch)
treedabd0daf3bde7d61509d3e496dd50f9a5b4602cf /src/main/resources
parentfacd0103437ffb50108113567d5fbb24487ffc81 (diff)
feat: implement products controller + pages
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/templates/productEdit.html48
-rw-r--r--src/main/resources/templates/products.html84
-rw-r--r--src/main/resources/templates/storage.html82
3 files changed, 214 insertions, 0 deletions
diff --git a/src/main/resources/templates/productEdit.html b/src/main/resources/templates/productEdit.html
new file mode 100644
index 0000000..dac8ba6
--- /dev/null
+++ b/src/main/resources/templates/productEdit.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" lang="en">
+<div th:replace="~{common :: head}"></div>
+
+<body>
+<div th:replace="~{common :: page-header}"></div>
+
+<div class="indent">
+ <div id="updateToggleSelector">
+ <button id="updateBtn" class="btn btn-primary" onclick="toggleDisabled()">Изменить</button> <br><br>
+ <a th:href="@{/operations(operationProductName=${product.getName()})}">
+ <button class="btn btn-primary">Операции с товаром</button>
+ </a><br><br>
+ <a th:href="@{/storage(storageName=${product.getName()})}">
+ <button class="btn btn-primary">К хранению товара</button>
+ </a><br><br>
+ </div>
+
+ <form method="post" action="/product">
+ <input disabled hidden id="productId" name="productId" th:value="${product.getId()}">
+
+ <label for="productName">Название:</label>
+ <input disabled type="text" id="productName" name="productName" required th:value="${product.getName()}"><br><br>
+
+ <label for="productHeight">Высота:</label>
+ <input disabled type="text" id="productHeight" name="productHeight" required th:value="${product.getHeight()}"><br><br>
+
+ <label for="productWidth">Ширина:</label>
+ <input disabled type="text" id="productWidth" name="productWidth" required th:value="${product.getWidth()}"><br><br>
+
+ <label for="productDepth">Глубина:</label>
+ <input disabled type="text" id="productDepth" name="productDepth" required th:value="${product.getDepth()}"><br><br>
+
+ <label for="productMaxStorageDuration">Срок хранения (дни):</label>
+ <input disabled type="text" id="productMaxStorageDuration" name="productMaxStorageDuration" th:value="${product.getMaxStorageDuration() == null ? '' : product.getMaxStorageDuration().toDays()}"><br><br>
+
+ <input id="saveBtn" type="submit" value="Сохранить" class="btn btn-primary" hidden>
+
+ </form>
+</div>
+
+
+<div th:replace="~{common :: site-footer}"></div>
+<div th:replace="~{common :: site-script}"></div>
+<div th:replace="~{common :: editFieldsToggle}"></div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/src/main/resources/templates/products.html b/src/main/resources/templates/products.html
new file mode 100644
index 0000000..4db7f21
--- /dev/null
+++ b/src/main/resources/templates/products.html
@@ -0,0 +1,84 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" lang="en">
+<div th:replace="~{common :: head}"></div>
+
+<body>
+<div th:replace="~{common :: page-header}"></div>
+
+<div class="indent">
+ <form method="get" action="/newProduct">
+ <button id="newOperationBtn" type="submit" class="btn btn-primary">Создать новый продукт</button>
+ </form>
+ <br>
+
+ <form method="get" action="/products">
+ <table class="table">
+ <thead class="theme-dark">
+ <tr>
+ <th colspan="6">Фильтры</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Название</td>
+ <td>
+ <input type="text" id="productNameFilter" name="productName" th:value="${productNameFilter}">
+ </td>
+ </tr>
+ <tr>
+ <td>Высота</td>
+ <td>
+ от <input type="text" id="productHeightGreaterFilter" name="productHeightGreater" th:value="${productHeightGreaterFilter}">
+ до <input type="text" id="productHeightLessFilter" name="productHeightLess" th:value="${productHeightLessFilter}">
+ </td>
+ </tr>
+ <tr>
+ <td>Ширина</td>
+ <td>
+ от <input type="text" id="productWidthGreaterFilter" name="productWidthGreater" th:value="${productWidthGreaterFilter}">
+ до <input type="text" id="productWidthLessFilter" name="productWidthLess" th:value="${productWidthLessFilter}">
+ </td>
+ </tr>
+ <tr>
+ <td>Глубина</td>
+ <td>
+ от <input type="text" id="productDepthGreaterFilter" name="productDepthGreater" th:value="${productDepthGreaterFilter}">
+ до <input type="text" id="productDepthLessFilter" name="productDepthLess" th:value="${productDepthLessFilter}">
+ </td>
+ </tr>
+ <tr>
+ <td colspan="6"><input id="saveBtn" type="submit" value="Применить" class="btn btn-primary"></td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+
+ <table class="table table-bordered table-warning">
+ <thead class="thead-dark">
+ <tr>
+ <th scope="col">Название</th>
+ <th scope="col">Габариты (В*Ш*Г)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr th:if="${products.isEmpty()}">
+ <td colspan="6">Данному фильтру не удовлетворяет ни одного продукта.</td>
+ </tr>
+ <tr th:each="product : ${products}">
+ <td>
+ <a th:href="'/product?id=' + ${product.getId()}">
+ <span th:text="${product.getName()}"></span>
+ </a>
+ </td>
+ <td>
+ <span th:text="${product.getHeight()} + ' * ' + ${product.getWidth()} + ' * ' + ${product.getDepth()}"></span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<div th:replace="~{common :: site-footer}"></div>
+<div th:replace="~{common :: site-script}"></div>
+</body>
+</html> \ No newline at end of file
diff --git a/src/main/resources/templates/storage.html b/src/main/resources/templates/storage.html
new file mode 100644
index 0000000..975af0f
--- /dev/null
+++ b/src/main/resources/templates/storage.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org" lang="en">
+<div th:replace="~{common :: head}"></div>
+
+<body>
+<div th:replace="~{common :: page-header}"></div>
+
+<div class="indent">
+ <form method="get" action="/storage">
+ <table class="table">
+ <thead class="theme-dark">
+ <tr>
+ <th colspan="6">Фильтры</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Название</td>
+ <td>
+ <input type="text" id="storageNameFilter" name="storageName" th:value="${storageNameFilter}">
+ </td>
+ </tr>
+ <tr>
+ <td>Статус</td>
+ <td>
+ <select id="storageStatusFilter" name="storageStatus">
+ <option value="">Любой</option>
+ <option th:value="'RESERVED_FOR_SUPPLY'" th:text="RESERVED_FOR_SUPPLY" th:selected="${storageStatusFilter == 'RESERVED_FOR_SUPPLY'}"></option>
+ <option th:value="'PLACED'" th:text="PLACED" th:selected="${storageStatusFilter == 'PLACED'}"></option>
+ <option th:value="'RESERVED_FOR_ISSUE'" th:text="RESERVED_FOR_ISSUE" th:selected="${storageStatusFilter == 'RESERVED_FOR_ISSUE'}"></option>
+ <option th:value="'PROHIBITED'" th:text="PROHIBITED" th:selected="${storageStatusFilter == 'PROHIBITED'}"></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="6"><input id="saveBtn" type="submit" value="Применить" class="btn btn-primary"></td>
+ </tr>
+ </tbody>
+ </table>
+ </form>
+
+ <table class="table table-bordered table-warning">
+ <thead class="thead-dark">
+ <tr>
+ <th scope="col">Название</th>
+ <th scope="col">Локация</th>
+ <th scope="col">Количество</th>
+ <th scope="col">Время размещения</th>
+ <th scope="col">Статус хранения</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr th:if="${storage.isEmpty()}">
+ <td colspan="6">Данному фильтру не удовлетворяет ни одного хранящегося продукта.</td>
+ </tr>
+ <tr th:each="productStorage : ${storage}">
+ <td>
+ <a th:href="'/product?id=' + ${productStorage.getProduct().getId()}">
+ <span th:text="${productStorage.getProduct().getName()}"></span>
+ </a>
+ </td>
+ <td>
+ <span th:text="${productStorage.getSlot().getLocation()}"></span>
+ </td>
+ <td>
+ <span th:text="${productStorage.getAmount()}"></span>
+ </td>
+ <td>
+ <span th:text="${productStorage.getPlacementTime()}"></span>
+ </td>
+ <td>
+ <span th:text="${productStorage.getStatus()}"></span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+</div>
+
+<div th:replace="~{common :: site-footer}"></div>
+<div th:replace="~{common :: site-script}"></div>
+</body>
+</html> \ No newline at end of file