complete lab

This commit is contained in:
Viltskaa 2023-05-06 11:31:38 +04:00
parent 459d16bfd7
commit 1e605c1009
25 changed files with 446 additions and 120 deletions

View File

@ -57,6 +57,13 @@
<artifactId>bootstrap</artifactId>
<version>5.2.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.datafaker/datafaker -->
<dependency>
<groupId>net.datafaker</groupId>
<artifactId>datafaker</artifactId>
<version>1.9.0</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,54 @@
package com.example.sybd.Random;
import com.example.sybd.models.*;
import net.datafaker.Faker;
import java.sql.Date;
import java.sql.Time;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.List;
public class random {
private static final Faker faker = new Faker();
public static Client getPerson() {
String tel = faker.phoneNumber()
.phoneNumberInternational()
.replace("-", "")
.replace(" ", "")
.substring(0, 11);
String address = faker.address().streetAddress();
Client client = new Client();
client.setName(faker.name().firstName());
client.setSecondName(faker.name().lastName());
client.setLastName("-");
client.setTelephone(tel);
client.setAddress(address);
return client;
}
public static Integer getNumber(Integer min, Integer max) {
return faker.number().numberBetween(min, max);
}
public static Visit getVisit(List<Client> clientList,
List<Worker> workerList,
List<Service> serviceList) {
Service service = serviceList.get(faker.number().numberBetween(0, serviceList.size()));
var workers = workerList.stream()
.filter((elem) -> elem.getPost().getGroup() == service.getGroup()).toList();
Worker worker = workers.get(faker.number().numberBetween(0, workers.size() - 1));
Client client = clientList.get(faker.number().numberBetween(0, clientList.size()));
Visit visit = new Visit();
visit.setClient(client);
visit.setService(service);
visit.setWorker(worker);
visit.setDateVisit(Date.valueOf(LocalDate.now().minusDays(faker.number().numberBetween(0, 30))));
visit.setTime(Time.valueOf(LocalTime.now()
.minusHours(faker.number().numberBetween(0, 6))
.minusMinutes(faker.number().numberBetween(0, 5) * 10L)
));
return visit;
}
}

View File

@ -1,42 +0,0 @@
//package com.example.sybd.controllers;
//
//import com.example.sybd.models.Service;
//import com.example.sybd.models.ServiceGroup;
//import com.example.sybd.repository.ServiceGroupRepository;
//import com.example.sybd.repository.ServiceRepository;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.StreamSupport;
//
//@RestController
//@RequestMapping("/serv")
//public class ServiceGroupController {
// @Autowired
// private ServiceGroupRepository serviceGroupRepository;
// @Autowired
// private ServiceRepository serviceRepository;
//
// @GetMapping("/all")
// public List<List<String>> all() {
// List<String> list1 = new ArrayList<>();
// for (ServiceGroup serviceGroup : serviceGroupRepository.findAll()) {
// String name = serviceGroup.getName();
// list1.add(name);
// }
// List<String> list2 = new ArrayList<>();
// for (Service service : serviceRepository.findAll()) {
// String name = service.getName();
// list2.add(name);
// }
// ArrayList<List<String>> out = new ArrayList<>();
// out.add(list1);
// out.add(list2);
// return out;
// }
//}

View File

@ -1,4 +0,0 @@
package com.example.sybd.controllers;
public class UserController {
}

View File

@ -1,38 +1,40 @@
package com.example.sybd.controllers;
import com.example.sybd.models.Visit;
import com.example.sybd.services.ClientService;
import com.example.sybd.services.ServicesService;
import com.example.sybd.services.VisitService;
import com.example.sybd.services.WorkerService;
import com.example.sybd.services.*;
import com.example.sybd.utils.mappingUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
@Controller
@RequestMapping("/worker")
@RequestMapping("/")
public class WorkerController {
private final VisitService visitService;
private final WorkerService workerService;
private final ClientService clientService;
private final ServicesService servicesService;
private final GroupServiceService groupServiceService;
private final PostService postService;
private final Integer pageSize = 10;
public WorkerController(VisitService visitService,
WorkerService workerService,
ClientService clientService,
ServicesService servicesService) {
ServicesService servicesService,
GroupServiceService groupServiceService,
PostService postService) {
this.visitService = visitService;
this.workerService = workerService;
this.clientService = clientService;
this.servicesService = servicesService;
this.groupServiceService = groupServiceService;
this.postService = postService;
}
@GetMapping("/")
public String main(Model model) {
model.addAttribute("visits", visitService.all());
model.addAttribute("workers", workerService.all());
model.addAttribute("create", "worker/create");
return "workerMain";
}
@ -54,13 +56,49 @@ public class WorkerController {
model.addAttribute("visits", visitService.all());
model.addAttribute("workers", workerService.all());
model.addAttribute("services", servicesService.all());
Visit visit = visitService.create(
visitService.create(
client,
service,
worker,
mappingUtils.strToDate(date),
mappingUtils.strToTime(time)
mappingUtils.strToTime(time),
false
);
return "workerMain";
}
@GetMapping("/service")
public String services(Model model) {
model.addAttribute("services", servicesService.all());
return "workerServices";
}
@PostMapping("/services")
public String servicesSubmit() {
return "workerServices";
}
@GetMapping("/serviceGroup")
public String serviceGroups(Model model) {
model.addAttribute("serviceGroups", groupServiceService.all());
return "workerServiceGroup";
}
@GetMapping("/users")
public String users(Model model) {
model.addAttribute("users", clientService.all());
return "workerUsers";
}
@GetMapping("/workers")
public String workers(Model model) {
model.addAttribute("workers", workerService.all());
return "workers";
}
@GetMapping("/posts")
public String posts(Model model) {
model.addAttribute("posts", postService.all());
return "workerPost";
}
}

View File

@ -0,0 +1,69 @@
package com.example.sybd.controllers;
import com.example.sybd.Random.random;
import com.example.sybd.models.Client;
import com.example.sybd.models.Visit;
import com.example.sybd.services.ClientService;
import com.example.sybd.services.ServicesService;
import com.example.sybd.services.VisitService;
import com.example.sybd.services.WorkerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/g")
@RestController
public class genController {
private final ClientService clientService;
private final WorkerService workerService;
private final ServicesService servicesService;
private final VisitService visitService;
public genController(ClientService clientService,
WorkerService workerService,
ServicesService servicesService,
VisitService visitService) {
this.clientService = clientService;
this.workerService = workerService;
this.servicesService = servicesService;
this.visitService = visitService;
}
@GetMapping("/")
public void generateBd() {
for (int i = 0; i < 10; i++) {
Client client = random.getPerson();
clientService.create(
client.getName(),
client.getSecondName(),
client.getLastName(),
client.getTelephone(),
client.getAddress()
);
Client worker = random.getPerson();
workerService.create(
worker.getName(),
worker.getSecondName(),
worker.getLastName(),
worker.getTelephone(),
worker.getAddress(),
Long.valueOf(random.getNumber(1, 8))
);
}
for (int i = 0; i < 100; i++) {
Visit visit = random.getVisit(
clientService.all(),
workerService.all(),
servicesService.all()
);
visitService.create(
visit.getClient().getId(),
visit.getService().getId(),
visit.getWorker().getId(),
visit.getDateVisit(),
visit.getTime(),
random.getNumber(0, 3) == 2
);
}
}
}

View File

@ -1,15 +0,0 @@
package com.example.sybd.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class testCont {
@GetMapping("/")
public String main(Model model) {
model.addAttribute("message", "hello world");
return "welcome";
}
}

View File

@ -14,7 +14,7 @@ import java.util.Collection;
@Table( name = "client" )
public class Client {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
@GeneratedValue( strategy = GenerationType.AUTO )
@Column( name = "id", nullable = false )
private Long id;

View File

@ -10,7 +10,7 @@ import lombok.Setter;
@Table( name = "post" )
public class Post {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
@GeneratedValue( strategy = GenerationType.AUTO )
@Column( name = "id", nullable = false )
private Long id;

View File

@ -12,7 +12,7 @@ import java.util.Collection;
@Table( name = "services" )
public class Service {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
@GeneratedValue( strategy = GenerationType.AUTO )
@Column( name = "id", nullable = false )
private Long id;

View File

@ -13,7 +13,7 @@ import lombok.Setter;
@Inheritance( strategy = InheritanceType.SINGLE_TABLE )
public class ServiceGroup {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
@GeneratedValue( strategy = GenerationType.AUTO )
@Column( name = "id", nullable = false )
private Long id;

View File

@ -13,7 +13,7 @@ import java.sql.Time;
@Table( name = "visit" )
public class Visit {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
@GeneratedValue( strategy = GenerationType.AUTO )
@Column( name = "id", nullable = false )
private Long id;

View File

@ -13,7 +13,7 @@ import java.util.Collection;
@Table( name = "worker" )
public class Worker {
@Id
@GeneratedValue( strategy = GenerationType.IDENTITY )
@GeneratedValue( strategy = GenerationType.AUTO )
@Column( name = "id", nullable = false )
private Long id;
@ -33,4 +33,10 @@ public class Worker {
public String getFio() {
return MessageFormat.format("{0} {1} {2}", secondName, name, lastName);
}
public Integer getMoney() {
return visits
.stream()
.filter(Visit::isEnded)
.reduce(0, (cost, element) -> cost + element.getService().getCost(), Integer::sum);
}
}

View File

@ -3,5 +3,9 @@ package com.example.sybd.repository;
import com.example.sybd.models.Worker;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
import java.util.Optional;
public interface WorkerRepository extends CrudRepository<Worker, Long> {
List<Worker> findAllByPostId(Long id);
}

View File

@ -35,7 +35,8 @@ public class VisitService implements IService<Visit, Long> {
@NotNull Long service_id,
@NotNull Long worker_id,
@NotNull Date date,
@NotNull Time time) {
@NotNull Time time,
@NotNull Boolean isEnd) {
Client client = clientService.get(client_id);
if (client == null)
return null;
@ -51,6 +52,7 @@ public class VisitService implements IService<Visit, Long> {
visit.setWorker(worker);
visit.setDateVisit(date);
visit.setTime(time);
visit.setEnded(isEnd);
return visitRepository.save(visit);
}

View File

@ -35,6 +35,7 @@ public class WorkerService implements IService<Worker, Long> {
out.setLastName(lastName);
out.setTelephone(telephone);
out.setAddress(address);
out.setPost(post);
return workerRepository.save(out);
}
@ -57,4 +58,8 @@ public class WorkerService implements IService<Worker, Long> {
public @Nullable Worker update(Worker other) {
return null;
}
public @Nullable List<Worker> getByPostId(Long id) {
return workerRepository.findAllByPostId(id);
}
}

View File

@ -14,5 +14,5 @@ spring.datasource.password=w12344321
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

View File

@ -1,24 +0,0 @@
<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Spring Boot Thymeleaf Hello World Example</title>
<link rel="stylesheet" th:href="@{webjars/bootstrap/4.2.1/css/bootstrap.min.css}"/>
<link rel="stylesheet" th:href="@{/css/main.css}"/>
</head>
<body>
<main role="main" class="container">
<div class="starter-template">
<h1>Spring Boot Web Thymeleaf Example</h1>
<h2>
<span th:text="'Hello, ' + ${message}"></span>
</h2>
</div>
</main>
<script type="text/javascript" th:src="@{webjars/bootstrap/4.2.1/js/bootstrap.min.js}"></script>
</body>
</html>

View File

@ -9,22 +9,23 @@
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" aria-current="page" href="/new">Новый сотрудник</a>
<a class="flex-fill text-sm-center nav-link" href="/visit">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/services">Услуги</a>
<select class="form-select form-select-sm w-25" aria-label="Сотдрудник">
<option th:each="worker : ${workers}" th:value="${worker.getId()}" th:text="${worker.getName()}"></option>
</select>
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<form action="#" th:action="@{/worker/create}" method="post">
<select class="form-select form-select-sm w-25" aria-label="Сотдрудник" th:name="worker">
<form action="#" th:action="@{/create}" method="post">
<select class="form-select form-select-sm w-100" aria-label="Сотдрудник" th:name="worker">
<option th:each="worker : ${workers}" th:value="${worker.getId()}" th:text="${worker.getName()}"></option>
</select>
<select class="form-select form-select-sm w-25" aria-label="Клиент" th:name="client">
<select class="form-select form-select-sm w-100" aria-label="Клиент" th:name="client">
<option th:each="client : ${clients}" th:value="${client.getId()}" th:text="${client.getName()}"></option>
</select>
<select class="form-select form-select-sm w-25" aria-label="Услуга" th:name="service">
<select class="form-select form-select-sm w-100" aria-label="Услуга" th:name="service">
<option th:each="service : ${services}" th:value="${service.getId()}" th:text="${service.getInfo()}"></option>
</select>
<div class="mb-3">

View File

@ -10,12 +10,13 @@
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" aria-current="page" href="/new">Новый сотрудник</a>
<a class="flex-fill text-sm-center nav-link" href="/visit">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/services">Услуги</a>
<select class="form-select form-select-sm w-25" aria-label="Сотдрудник">
<option th:each="worker : ${workers}" th:value="${worker.getId()}" th:text="${worker.getName()}"></option>
</select>
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<ul class="list-group">

View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<ul class="list-group">
<li th:each="post : ${posts}" class="list-group-item">
<div class="card border-0">
<div class="card-header">
<h5>
Должность #<span th:text="${post.getId().toString()}"></span>
</h5>
</div>
<div class="card-body">
<h6 class="card-text">
<b>Название:</b> <span th:text="${post.getName()}"></span>
</h6>
<h6 class="card-text">
<b>Группа услуг:</b> <span th:text="${post.getGroup().getName()}"></span>
</h6>
</div>
</div>
</li>
</ul>
</main>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<ul class="list-group">
<li th:each="serviceGroup : ${serviceGroups}" class="list-group-item">
<div class="card border-0">
<div class="card-header">
<h5>
Группа услуг #<span th:text="${serviceGroup.getId().toString()}"></span>
</h5>
</div>
<div class="card-body">
<h6 class="card-text">
<b>Название:</b> <span th:text="${serviceGroup.getName()}"></span>
</h6>
</div>
</div>
</li>
</ul>
</main>
</body>
</html>

View File

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<ul class="list-group">
<li th:each="service : ${services}" class="list-group-item">
<div class="card border-0">
<div class="card-header">
<h5>
Услуга #<span th:text="${service.getId().toString()}"></span>
</h5>
</div>
<div class="card-body">
<h6 class="card-text">
<b>Название:</b> <span th:text="${service.getName()}"></span>
</h6>
</div>
<div class="card-footer">
<h6>Цена: <span th:text="${service.getCost()}"></span>руб.</h6>
</div>
</div>
</li>
</ul>
</main>
</body>
</html>

View File

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<ul class="list-group">
<li th:each="user : ${users}" class="list-group-item">
<div class="card border-0">
<div class="card-header">
<h5>
Пользователь #<span th:text="${user.getId().toString()}"></span>
</h5>
</div>
<div class="card-body">
<h6 class="card-text">
<b>ФИО:</b> <span th:text="${user.getFio()}"></span>
</h6>
<h6 class="card-text">
<b>Телефон:</b> <span th:text="${user.getTelephone()}"></span>
</h6>
<h6 class="card-text">
<b>Адрес:</b> <span th:text="${user.getAddress()}"></span>
</h6>
</div>
</div>
</li>
</ul>
</main>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
</head>
<body>
<nav class="nav nav-pills flex-row p-2">
<a class="flex-fill text-sm-center nav-link" href="/">Посещения</a>
<a class="flex-fill text-sm-center nav-link" href="/create">Создать визит</a>
<a class="flex-fill text-sm-center nav-link" href="/service">Услуги</a>
<a class="flex-fill text-sm-center nav-link" href="/serviceGroup">Группа услуг</a>
<a class="flex-fill text-sm-center nav-link" href="/users">Пользователи</a>
<a class="flex-fill text-sm-center nav-link" href="/workers">Сотрудники</a>
<a class="flex-fill text-sm-center nav-link" href="/posts">Должности</a>
</nav>
<main class="mt-5 p-2">
<ul class="list-group">
<li th:each="worker : ${workers}" class="list-group-item">
<div class="card border-0">
<div class="card-header">
<h5>
Сотдрудник #<span th:text="${worker.getId().toString()}"></span>
</h5>
</div>
<div class="card-body">
<h6 class="card-text">
<b>ФИО:</b> <span th:text="${worker.getFio()}"></span>
</h6>
<h6 class="card-text">
<b>Должность:</b> <span th:text="${worker.getPost().getName()}"></span>
</h6>
<h6 class="card-text">
<b>Телефон:</b> <span th:text="${worker.getTelephone()}"></span>
</h6>
<h6 class="card-text">
<b>Адрес:</b> <span th:text="${worker.getAddress()}"></span>
</h6>
</div>
<div class="card-footer">
<h6>Заработал: <span th:text="${worker.getMoney()}"></span>руб.</h6>
</div>
</div>
</li>
</ul>
</main>
</body>
</html>