Files
elink-test-master/src/main/resources/templates/page/routes/groupEdit.html
T
2025-02-05 22:32:28 +09:00

78 lines
2.9 KiB
HTML

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorate="~{layout/default_layout}">
<body>
<section layout:fragment="contentFragment">
<div class="container-fluid mt-2">
<form name="groupForm" id="groupForm"
th:action="${group.id == null}?@{/mgmt/routes/group/register.do}:@{/mgmt/routes/group/update.do}"
th:object='${group}' method="post">
<div class="card col-md">
<div class="card-header">
<h3 th:if="${group.id == null}">API 그룹 등록</h3>
<h3 th:if="${group.id != null}">API 그룹 수정</h3>
</div>
<div class="card-body">
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}">
<input type="hidden" name="id" th:value="${group.id}" th:if="${group.id != null}">
<div class="form-floating mt-2">
<input type="text" class="form-control"
th:classappend="${#fields.hasErrors('id')}? 'is-invalid'"
th:field="*{id}" required th:readonly="${group.id != null}"/>
<label for="id" class="form-label must">그룹 ID</label>
<th:block th:each="err : ${#fields.errors('id')}">
<div th:text="${err}" class="invalid-feedback"></div>
</th:block>
</div>
<div class="form-floating mt-2">
<input type="text" class="form-control"
th:classappend="${#fields.hasErrors('name')}? 'is-invalid'"
th:field="*{name}" required/>
<label for="name" class="form-label must">그룹명</label>
<th:block th:each="err : ${#fields.errors('name')}">
<div th:text="${err}" class="invalid-feedback"></div>
</th:block>
</div>
</div>
<div class="card-footer">
<button type="button" class="btn btn-primary btn_list">
<i class="fa-solid fa-list"></i> 목록
</button>
<button type="button" class="btn btn-primary btn_register">
<i class="fa-sharp fa-solid fa-floppy-disk"></i> 저장
</button>
</div>
</div>
</form>
</div>
</section>
</body>
<th:block layout:fragment="contentScript">
<script>
$(function () {
let fnRegister = document.querySelector(".btn_register");
let fnList = document.querySelector(".btn_list");
fnRegister.addEventListener("click", function (event) {
let form = document.getElementById("groupForm");
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
} else {
form.submit();
}
form.classList.add('was-validated');
});
fnList.addEventListener("click", function () {
location.href = "[[@{/mgmt/routes/group/list_view.do}]]";
});
});
</script>
</th:block>
</html>