Хоть мне это не нравилось, но я сделал
This commit is contained in:
parent
1b1d31e033
commit
02e24932d4
BIN
data.mv.db
BIN
data.mv.db
Binary file not shown.
@ -11810,3 +11810,50 @@ Database is already closed (to disable automatic closing at VM shutdown, add ";D
|
|||||||
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
|
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
|
||||||
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
|
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
|
||||||
at java.base/java.lang.Thread.run(Thread.java:833)
|
at java.base/java.lang.Thread.run(Thread.java:833)
|
||||||
|
2023-05-14 10:12:20 database: flush
|
||||||
|
org.h2.message.DbException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/Users/Admin/Downloads/IP/IP/data.mv.db [2.1.210/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/Users/Admin/Downloads/IP/IP/data.mv.db [2.1.210/7]" [50000-210]
|
||||||
|
at org.h2.message.DbException.get(DbException.java:216)
|
||||||
|
at org.h2.message.DbException.convert(DbException.java:414)
|
||||||
|
at org.h2.mvstore.db.Store.lambda$new$0(Store.java:120)
|
||||||
|
at org.h2.mvstore.MVStore.handleException(MVStore.java:3296)
|
||||||
|
at org.h2.mvstore.MVStore.panic(MVStore.java:585)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:461)
|
||||||
|
at org.h2.mvstore.MVStore$Builder.open(MVStore.java:4056)
|
||||||
|
at org.h2.mvstore.db.Store.<init>(Store.java:129)
|
||||||
|
at org.h2.engine.Database.<init>(Database.java:324)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:92)
|
||||||
|
at org.h2.engine.Engine.openSession(Engine.java:222)
|
||||||
|
at org.h2.engine.Engine.createSession(Engine.java:201)
|
||||||
|
at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
|
||||||
|
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
|
||||||
|
at org.h2.Driver.connect(Driver.java:59)
|
||||||
|
at com.intellij.database.remote.jdbc.helpers.JdbcHelperImpl.connect(JdbcHelperImpl.java:670)
|
||||||
|
at com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:64)
|
||||||
|
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||||
|
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||||
|
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||||
|
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||||
|
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
|
||||||
|
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
|
||||||
|
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
|
||||||
|
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
|
||||||
|
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
|
||||||
|
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||||
|
at java.base/java.lang.Thread.run(Thread.java:833)
|
||||||
|
Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Внутренняя ошибка: "org.h2.mvstore.MVStoreException: The file is locked: C:/Users/Admin/Downloads/IP/IP/data.mv.db [2.1.210/7]"
|
||||||
|
General error: "org.h2.mvstore.MVStoreException: The file is locked: C:/Users/Admin/Downloads/IP/IP/data.mv.db [2.1.210/7]" [50000-210]
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:573)
|
||||||
|
at org.h2.message.DbException.getJdbcSQLException(DbException.java:496)
|
||||||
|
... 34 more
|
||||||
|
Caused by: org.h2.mvstore.MVStoreException: The file is locked: C:/Users/Admin/Downloads/IP/IP/data.mv.db [2.1.210/7]
|
||||||
|
at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:1004)
|
||||||
|
at org.h2.mvstore.FileStore.open(FileStore.java:163)
|
||||||
|
at org.h2.mvstore.MVStore.<init>(MVStore.java:444)
|
||||||
|
... 28 more
|
||||||
|
@ -55,7 +55,7 @@ public class StudentDTO {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBirthDate(String birthDate){
|
public void setBirthDate(LocalDate birthDate){
|
||||||
this.birthDate = LocalDate.parse(birthDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
this.birthDate = birthDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,7 @@ public class SubjectDTO {
|
|||||||
return groupIds;
|
return groupIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setName(String name){
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,20 @@
|
|||||||
package ru.IP_LabWorks.IP.University.Contoller.MVC;
|
package ru.IP_LabWorks.IP.University.Contoller.MVC;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import ru.IP_LabWorks.IP.University.Contoller.DTO.GroupDTO;
|
import ru.IP_LabWorks.IP.University.Contoller.DTO.GroupDTO;
|
||||||
import ru.IP_LabWorks.IP.University.Contoller.DTO.StudentDTO;
|
import ru.IP_LabWorks.IP.University.Contoller.DTO.StudentDTO;
|
||||||
|
import ru.IP_LabWorks.IP.University.Model.Student;
|
||||||
|
import ru.IP_LabWorks.IP.University.Model.Subject;
|
||||||
import ru.IP_LabWorks.IP.University.Service.GroupService;
|
import ru.IP_LabWorks.IP.University.Service.GroupService;
|
||||||
import ru.IP_LabWorks.IP.University.Service.StudentService;
|
import ru.IP_LabWorks.IP.University.Service.StudentService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/group")
|
@RequestMapping("/group")
|
||||||
public class GroupMvcController {
|
public class GroupMvcController {
|
||||||
@ -41,7 +46,7 @@ public class GroupMvcController {
|
|||||||
return "group-edit";
|
return "group-edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = {"", "/{id}"})
|
@PostMapping(value = {"/", "/{id}"})
|
||||||
public String saveGroup(@PathVariable(required = false) Long id,
|
public String saveGroup(@PathVariable(required = false) Long id,
|
||||||
@ModelAttribute @Valid GroupDTO groupDTO,
|
@ModelAttribute @Valid GroupDTO groupDTO,
|
||||||
BindingResult bindingResult,
|
BindingResult bindingResult,
|
||||||
@ -63,4 +68,18 @@ public class GroupMvcController {
|
|||||||
groupService.deleteGroup(id);
|
groupService.deleteGroup(id);
|
||||||
return "redirect:/group";
|
return "redirect:/group";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/students/{id}")
|
||||||
|
public String getStudentsFromGroup(@PathVariable Long id, Model model) {
|
||||||
|
List<Student> students = groupService.getStudentFromGroup(id);
|
||||||
|
model.addAttribute("students", students);
|
||||||
|
return "view-students";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/subjects/{id}")
|
||||||
|
public String getSubjectsFromGroup(@PathVariable Long id, Model model) {
|
||||||
|
List<Subject> subjects = groupService.getSubjectInGroup(id);
|
||||||
|
model.addAttribute("subjects", subjects);
|
||||||
|
return "view-subjects";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
package ru.IP_LabWorks.IP.University.Contoller.MVC;
|
package ru.IP_LabWorks.IP.University.Contoller.MVC;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import ru.IP_LabWorks.IP.University.Contoller.DTO.GroupDTO;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import ru.IP_LabWorks.IP.University.Contoller.DTO.StudentDTO;
|
import ru.IP_LabWorks.IP.University.Contoller.DTO.StudentDTO;
|
||||||
import ru.IP_LabWorks.IP.University.Service.GroupService;
|
import ru.IP_LabWorks.IP.University.Service.GroupService;
|
||||||
import ru.IP_LabWorks.IP.University.Service.StudentService;
|
import ru.IP_LabWorks.IP.University.Service.StudentService;
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/student")
|
@RequestMapping("/student")
|
||||||
@ -34,9 +37,9 @@ public class StudentMvcController {
|
|||||||
@GetMapping(value = {"/edit", "/edit/{id}"})
|
@GetMapping(value = {"/edit", "/edit/{id}"})
|
||||||
public String editStudent(@PathVariable(required = false) Long id,
|
public String editStudent(@PathVariable(required = false) Long id,
|
||||||
Model model) {
|
Model model) {
|
||||||
|
model.addAttribute("Groups", groupService.findAllGroups());
|
||||||
if (id == null || id <= 0) {
|
if (id == null || id <= 0) {
|
||||||
model.addAttribute("studentDTO", new StudentDTO());
|
model.addAttribute("studentDTO", new StudentDTO());
|
||||||
model.addAttribute("Groups", groupService.findAllGroups());
|
|
||||||
} else {
|
} else {
|
||||||
model.addAttribute("studentId", id);
|
model.addAttribute("studentId", id);
|
||||||
model.addAttribute("studentDTO", new StudentDTO(studentService.findStudent(id)));
|
model.addAttribute("studentDTO", new StudentDTO(studentService.findStudent(id)));
|
||||||
|
@ -1,9 +1,85 @@
|
|||||||
package ru.IP_LabWorks.IP.University.Contoller.MVC;
|
package ru.IP_LabWorks.IP.University.Contoller.MVC;
|
||||||
|
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import ru.IP_LabWorks.IP.University.Contoller.DTO.SubjectDTO;
|
||||||
|
import ru.IP_LabWorks.IP.University.Service.GroupService;
|
||||||
|
import ru.IP_LabWorks.IP.University.Service.SubjectService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/subject")
|
@RequestMapping("/subject")
|
||||||
public class SubjectMvcController {
|
public class SubjectMvcController {
|
||||||
|
private final SubjectService subjectService;
|
||||||
|
|
||||||
|
private final GroupService groupService;
|
||||||
|
|
||||||
|
public SubjectMvcController(SubjectService subjectService, GroupService groupService)
|
||||||
|
{
|
||||||
|
this.subjectService = subjectService;
|
||||||
|
this.groupService = groupService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public String getSubjects(Model model) {
|
||||||
|
model.addAttribute("subjects",
|
||||||
|
subjectService.findAllSubjects().stream()
|
||||||
|
.map(SubjectDTO::new)
|
||||||
|
.toList());
|
||||||
|
return "subject";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = {"/edit", "/edit/{id}"})
|
||||||
|
public String editSubject(@PathVariable(required = false) Long id,
|
||||||
|
Model model) {
|
||||||
|
if (id == null || id <= 0) {
|
||||||
|
model.addAttribute("subjectDTO", new SubjectDTO());
|
||||||
|
} else {
|
||||||
|
model.addAttribute("subjectId", id);
|
||||||
|
model.addAttribute("subjectDTO", new SubjectDTO(subjectService.findSubject(id)));
|
||||||
|
}
|
||||||
|
return "subject-edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = {"/", "/{id}"})
|
||||||
|
public String saveSubject(@PathVariable(required = false) Long id,
|
||||||
|
@ModelAttribute @Valid SubjectDTO subjectDTO,
|
||||||
|
BindingResult bindingResult,
|
||||||
|
Model model) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
model.addAttribute("errors", bindingResult.getAllErrors());
|
||||||
|
return "subject-edit";
|
||||||
|
}
|
||||||
|
if (id == null || id <= 0) {
|
||||||
|
subjectService.addSubject(subjectDTO.getName());
|
||||||
|
} else {
|
||||||
|
subjectService.updateSubject(id, subjectDTO.getName());
|
||||||
|
}
|
||||||
|
return "redirect:/subject";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete/{id}")
|
||||||
|
public String deleteSubject(@PathVariable Long id) {
|
||||||
|
subjectService.deleteSubject(id);
|
||||||
|
return "redirect:/subject";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/addSubjectToGroup/{id}")
|
||||||
|
public String addSubjectToGroupForm(@PathVariable Long id, Model model) {
|
||||||
|
model.addAttribute("subjectDTO", new SubjectDTO(subjectService.findSubject(id)));
|
||||||
|
model.addAttribute("subjectId", id);
|
||||||
|
model.addAttribute("groups", groupService.findAllGroups());
|
||||||
|
return "add-subject-to-group";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/addSubjectToGroup/{id}")
|
||||||
|
public String addSubjectToGroup(@PathVariable Long id,
|
||||||
|
@RequestParam("groupId") List<Long> groupIds) {
|
||||||
|
subjectService.addSubjectToGroup(id, groupIds);
|
||||||
|
return "redirect:/subject";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
38
src/main/resources/templates/add-subject-to-group.html
Normal file
38
src/main/resources/templates/add-subject-to-group.html
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||||
|
<form action="#" th:action="@{/subject/addSubjectToGroup/{id}(id=${subjectId})}" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Название</label>
|
||||||
|
<input type="text" class="form-control" id="name" th:field="${subjectDTO.name}" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name">Выберите группы для добавления:</label>
|
||||||
|
<ul class="list-group">
|
||||||
|
<li class="list-group-item" th:each="group, iterator: ${groups}">
|
||||||
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" th:id="'groupId-' + ${group.id}"
|
||||||
|
th:value="${group.id}" th:checked="${subjectDTO.groupIds.contains(group.id)}" name="groupId">
|
||||||
|
<label class="form-check-label" th:for="'groupId-' + ${group.id}" th:text="${group.name}"></label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<button type="submit" class="btn btn-primary button-fixed">
|
||||||
|
<span>Добавить</span>
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-secondary button-fixed" th:href="@{/subject}">
|
||||||
|
Назад
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -24,6 +24,7 @@
|
|||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<a class="nav-link" href="/student" th:classappend="${#strings.equals(activeLink, '/student')} ? 'active' : ''">Студенты</a>
|
<a class="nav-link" href="/student" th:classappend="${#strings.equals(activeLink, '/student')} ? 'active' : ''">Студенты</a>
|
||||||
<a class="nav-link" href="/group" th:classappend="${#strings.equals(activeLink, '/group')} ? 'active' : ''">Группы</a>
|
<a class="nav-link" href="/group" th:classappend="${#strings.equals(activeLink, '/group')} ? 'active' : ''">Группы</a>
|
||||||
|
<a class="nav-link" href="/subject" th:classappend="${#strings.equals(activeLink, '/subject')} ? 'active' : ''">Предметы</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
27
src/main/resources/templates/group-edit.html
Normal file
27
src/main/resources/templates/group-edit.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||||
|
<form action="#" th:action="@{/group/{id}(id=${id})}" th:object="${groupDTO}" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Название</label>
|
||||||
|
<input type="text" class="form-control" id="name" th:field="${groupDTO.name}" required="true">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<button type="submit" class="btn btn-primary button-fixed">
|
||||||
|
<span th:if="${groupId == null}">Добавить</span>
|
||||||
|
<span th:if="${groupId != null}">Обновить</span>
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-secondary button-fixed" th:href="@{/group}">
|
||||||
|
Назад
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -4,7 +4,49 @@
|
|||||||
layout:decorate="~{default}">
|
layout:decorate="~{default}">
|
||||||
<body>
|
<body>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
|
<h1 class="text-center mb-4">Group Table</h1>
|
||||||
|
<div>
|
||||||
|
<a class="btn btn-success button-fixed"
|
||||||
|
th:href="@{/group/edit}">
|
||||||
|
<i class="fa-solid fa-plus"></i> Добавить
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="group, iterator: ${groups}">
|
||||||
|
<td th:text="${group.name}"></td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
<a class="btn btn-warning button-fixed button-sm"
|
||||||
|
th:href="@{/group/edit/{id}(id=${group.id})}">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-danger button-fixed button-sm"
|
||||||
|
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${group.id}').click()|">
|
||||||
|
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-primary button-fixed button-sm"
|
||||||
|
th:href="@{/group/students/{id}(id=${group.id})}">Посмотреть студентов</a>
|
||||||
|
<a class="btn btn-primary button-fixed button-sm"
|
||||||
|
th:href="@{/group/subjects/{id}(id=${group.id})}">Посмотреть предметы</a>
|
||||||
|
</div>
|
||||||
|
<form th:action="@{/group/delete/{id}(id=${group.id})}" method="post">
|
||||||
|
<button th:id="'remove-' + ${group.id}" type="submit" style="display: none">
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -7,7 +7,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||||
<form action="#" th:action="@{/student/{id}(id=${id})}" th:object="${studentDTO}" method="post">
|
<form action="#" th:action="@{/student}" th:object="${studentDTO}" method="post">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="name" class="form-label">ФИО</label>
|
<label for="name" class="form-label">ФИО</label>
|
||||||
<input type="text" class="form-control" id="name" th:field="${studentDTO.name}" required="true">
|
<input type="text" class="form-control" id="name" th:field="${studentDTO.name}" required="true">
|
||||||
@ -24,8 +24,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<button type="submit" class="btn btn-primary button-fixed">
|
<button type="submit" class="btn btn-primary button-fixed">
|
||||||
<span th:if="${id == null}">Добавить</span>
|
<span th:if="${studentId == null}">Добавить</span>
|
||||||
<span th:if="${id != null}">Обновить</span>
|
<span th:if="${studentId != null}">Обновить</span>
|
||||||
</button>
|
</button>
|
||||||
<a class="btn btn-secondary button-fixed" th:href="@{/student}">
|
<a class="btn btn-secondary button-fixed" th:href="@{/student}">
|
||||||
Назад
|
Назад
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en"
|
<html lang="en"
|
||||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
layout:decorate="~{default}">
|
layout:decorate="~{default}" xmlns:th="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
|
<h1 class="text-center mb-4">Student Table</h1>
|
||||||
<div>
|
<div>
|
||||||
<a class="btn btn-success button-fixed"
|
<a class="btn btn-success button-fixed"
|
||||||
th:href="@{/student/edit}">
|
th:href="@{/student/edit}">
|
||||||
|
27
src/main/resources/templates/subject-edit.html
Normal file
27
src/main/resources/templates/subject-edit.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<div th:text="${errors}" class="margin-bottom alert-danger"></div>
|
||||||
|
<form action="#" th:action="@{/subject/{id}(id=${id})}" th:object="${subjectDTO}" method="post">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Название</label>
|
||||||
|
<input type="text" class="form-control" id="name" th:field="${subjectDTO.name}" required="true">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<button type="submit" class="btn btn-primary button-fixed">
|
||||||
|
<span th:if="${subjectId == null}">Добавить</span>
|
||||||
|
<span th:if="${subjectId != null}">Обновить</span>
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-secondary button-fixed" th:href="@{/subject}">
|
||||||
|
Назад
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -4,7 +4,49 @@
|
|||||||
layout:decorate="~{default}">
|
layout:decorate="~{default}">
|
||||||
<body>
|
<body>
|
||||||
<div layout:fragment="content">
|
<div layout:fragment="content">
|
||||||
|
<h1 class="text-center mb-4">Subject Table</h1>
|
||||||
|
<div>
|
||||||
|
<a class="btn btn-success button-fixed"
|
||||||
|
th:href="@{/subject/edit}">
|
||||||
|
<i class="fa-solid fa-plus"></i> Добавить
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
<th scope="col"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="subject, iterator: ${subjects}">
|
||||||
|
<td th:text="${subject.name}"></td>
|
||||||
|
<td>
|
||||||
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
|
<a class="btn btn-warning button-fixed button-sm"
|
||||||
|
th:href="@{/subject/edit/{id}(id=${subject.id})}">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i> Изменить
|
||||||
|
</a>
|
||||||
|
<button type="button" class="btn btn-danger button-fixed button-sm"
|
||||||
|
th:attr="onclick=|confirm('Удалить запись?') && document.getElementById('remove-${subject.id}').click()|">
|
||||||
|
<i class="fa fa-trash" aria-hidden="true"></i> Удалить
|
||||||
|
</button>
|
||||||
|
<a class="btn btn-primary button-fixed button-sm"
|
||||||
|
th:href="@{/subject/addSubjectToGroup/{id}(id=${subject.id})}">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i> Добавить предметы в группы
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<form th:action="@{/subject/delete/{id}(id=${subject.id})}" method="post">
|
||||||
|
<button th:id="'remove-' + ${subject.id}" type="submit" style="display: none">
|
||||||
|
Удалить
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
30
src/main/resources/templates/view-students.html
Normal file
30
src/main/resources/templates/view-students.html
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">ФИО</th>
|
||||||
|
<th scope="col">Дата рождения</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="student, iterator: ${students}">
|
||||||
|
<td th:text="${student.name}"></td>
|
||||||
|
<td th:text="${student.birthDate}"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<a class="btn btn-secondary button-fixed" th:href="@{/group}">
|
||||||
|
Назад
|
||||||
|
</a>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
28
src/main/resources/templates/view-subjects.html
Normal file
28
src/main/resources/templates/view-subjects.html
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en"
|
||||||
|
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
layout:decorate="~{default}">
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div layout:fragment="content">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Название</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr th:each="subject, iterator: ${subjects}">
|
||||||
|
<td th:text="${subject.name}"></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
<a class="btn btn-secondary button-fixed" th:href="@{/group}">
|
||||||
|
Назад
|
||||||
|
</a>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user