Merge branch 'h-hein2' of https://gitea.it-college.co.jp/2026_0910_AI_5G_Java_MUN/last-group-delevelopment-team2 into o-matsuda
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -37,7 +36,7 @@ public class AdminLoanController {
|
||||
public String approvalConfirm(@PathVariable Integer id, Model model, RedirectAttributes ra) {
|
||||
try {
|
||||
model.addAttribute("r", loanService.getView(id, Const.STATUS_WAITING));
|
||||
return "approvalConfirm";
|
||||
return "approvalConfilm";
|
||||
} catch (BusinessException e) {
|
||||
ra.addFlashAttribute("errorMessage", e.getMessage());
|
||||
return "redirect:/admin/applications";
|
||||
@@ -50,7 +49,7 @@ public class AdminLoanController {
|
||||
try {
|
||||
loanService.approve(id, admin);
|
||||
ra.addFlashAttribute("message", "書籍貸出申請を承認しました。");
|
||||
return "redirect:/admin/approval/complete";
|
||||
return "approvalComplete";
|
||||
} catch (BusinessException e) {
|
||||
ra.addFlashAttribute("errorMessage", e.getMessage());
|
||||
return "redirect:/admin/applications";
|
||||
@@ -63,7 +62,7 @@ public class AdminLoanController {
|
||||
try {
|
||||
loanService.reject(id, admin);
|
||||
ra.addFlashAttribute("message", "書籍貸出申請を却下しました。");
|
||||
return "redirect:/admin/approval/complete";
|
||||
return "approvalRejected";
|
||||
} catch (BusinessException e) {
|
||||
ra.addFlashAttribute("errorMessage", e.getMessage());
|
||||
return "redirect:/admin/applications";
|
||||
@@ -116,3 +115,4 @@ public class AdminLoanController {
|
||||
return "complete";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.example.demo.service;
|
||||
|
||||
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -18,6 +15,7 @@ import com.example.demo.form.BookForm;
|
||||
import com.example.demo.repository.BookCollectionRepository;
|
||||
|
||||
/** BOOK-02:書籍登録、BOOK-03:書籍編集 */
|
||||
|
||||
@Service
|
||||
public class BookAdminService {
|
||||
private final BookCollectionRepository bookRepository;
|
||||
@@ -83,6 +81,7 @@ public class BookAdminService {
|
||||
if (!errors.isEmpty()) throw new BusinessException(String.join(" ", errors));
|
||||
}
|
||||
|
||||
|
||||
private static void apply(BookCollection b, BookForm f) {
|
||||
b.setIsbn(f.getIsbn());
|
||||
b.setNmBook(f.getNmBook());
|
||||
@@ -90,4 +89,5 @@ public class BookAdminService {
|
||||
b.setPublisher(f.getPublisher().isEmpty() ? null : f.getPublisher());
|
||||
b.setNote(f.getNote().isEmpty() ? null : f.getNote());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
31
book-rent/src/main/resources/templates/approvalComplete.html
Normal file
31
book-rent/src/main/resources/templates/approvalComplete.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>書籍貸出申請</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>
|
||||
|
||||
<div class="rightSection">
|
||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||
</div>
|
||||
</h1>
|
||||
<h2>書籍貸出申請を承認しました。</h2>
|
||||
|
||||
|
||||
<form action="returnComplete" method="post" >
|
||||
|
||||
<div class="msgBox error" th:if="${messageError} != null">
|
||||
<span class="error" th:text="${messageError.message}"></span>
|
||||
</div>
|
||||
</form>
|
||||
<a th:href="@{/admin/applications}">承認待ち一覧に戻る</a>
|
||||
<a href="showMenu">メニューに戻る</a>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
84
book-rent/src/main/resources/templates/approvalConfilm.html
Normal file
84
book-rent/src/main/resources/templates/approvalConfilm.html
Normal file
@@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>書籍貸出承認確認</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>
|
||||
書籍貸出承認確認
|
||||
<div class="rightSection">
|
||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||
</div>
|
||||
</h1>
|
||||
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th class="header">申請ID</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.idRequest}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">申請者名</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.nmApplicant}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">申請日</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.dateRequest}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">ISBN</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.isbn}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">書籍名</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.nmBook}" style="width: 300px;" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">出版社</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.publisher}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">特記事項</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.note}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">貸出日</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.dateBorrow}" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header">返却予定日</th>
|
||||
<td><input type="text" readonly="readonly" th:value="${r.dateScheduledReturn}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="buttonSection" style="margin-top: 20px;">
|
||||
|
||||
<form th:action="@{/admin/applications/{id}/approve(id=${r.idRequest})}" method="post" style="display: inline;">
|
||||
<button type="submit">承認</button>
|
||||
</form>
|
||||
|
||||
|
||||
<form th:action="@{/admin/applications/{id}/reject(id=${r.idRequest})}" method="post"
|
||||
style="display: inline; margin-left: 10px;">
|
||||
<button type="submit">却下</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<a th:href="@{/admin/applications}">承認待ち一覧へ戻る</a>
|
||||
|
||||
<script>
|
||||
function logoutSubmit() {
|
||||
if (confirm("ログアウトしますか?")) {
|
||||
window.location.href = "/logout";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
31
book-rent/src/main/resources/templates/approvalRejected.html
Normal file
31
book-rent/src/main/resources/templates/approvalRejected.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>書籍貸出申請</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>
|
||||
|
||||
<div class="rightSection">
|
||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||
</div>
|
||||
</h1>
|
||||
<h2>書籍貸出申請を却下しました。</h2>
|
||||
|
||||
|
||||
<form action="returnRejected" method="post">
|
||||
|
||||
<div class="msgBox error" th:if="${messageError} != null">
|
||||
<span class="error" th:text="${messageError.message}"></span>
|
||||
</div>
|
||||
</form>
|
||||
<a th:href="@{/admin/applications}">承認待ち一覧に戻る</a>
|
||||
<a href="showMenu">メニューに戻る</a>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
34
book-rent/src/main/resources/templates/lendingList.html
Normal file
34
book-rent/src/main/resources/templates/lendingList.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>貸出中書籍一覧</title>
|
||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||
</head>
|
||||
<body>
|
||||
<div th:replace="~{fragments/header :: header}"></div>
|
||||
<main>
|
||||
<h1>貸出中書籍一覧</h1>
|
||||
<div class="error" th:if="${errorMessage}" th:text="${errorMessage}"></div>
|
||||
<div class="error" th:each="e : ${errors}" th:text="${e}"></div>
|
||||
<div class="card">
|
||||
<p th:if="${#lists.isEmpty(list)}">貸出中の書籍はありません。</p>
|
||||
<table th:unless="${#lists.isEmpty(list)}">
|
||||
<thead><tr><th>申請ID</th><th>申請者名</th><th>書籍名</th><th>申請日</th><th>貸出日</th><th>返却予定日</th><th>操作</th></tr></thead>
|
||||
<tbody>
|
||||
<tr th:each="r : ${list}">
|
||||
<td th:text="${r.idRequest}"></td>
|
||||
<td th:text="${r.nmApplicant}"></td>
|
||||
<td th:text="${r.nmBook}"></td>
|
||||
<td th:text="${r.dateRequest}"></td>
|
||||
<td th:text="${r.dateBorrow}"></td>
|
||||
<td th:text="${r.dateScheduledReturn}"></td>
|
||||
<td><a class="btn" th:href="@{/admin/lendings/{id}(id=${r.idRequest})}">返却</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p><a class="btn sub" th:href="@{/menu}">メニューに戻る</a></p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user